package com.wm.gridimageupload.bean

import android.text.TextUtils
import com.luck.picture.lib.entity.LocalMedia

class ImageInfoBean : Cloneable {

    var localMedia: LocalMedia? = null //三方库的图片选择实体


    private var isServer = false
    private var needWater = false //true 需要水印

    private var fileRecordMainId: String? = null

    private var type: String? = null // 图片类型（报备、带看、大定、名片）

    /**
     * 图片的路径、url
     */
    private var path: String? = null
    private var waterUrl: String? = null
    private var picId: String? = null

    /**
     * 图片上传完成之后的url(大中小图)
     */
    private var picUrl_500: String? = null
    private var picUrl_50_percent: String? = null
    private var picUrl_20_percent: String? = null

    /**
     * 图片上传的进度 0-100 小于0的情况，图片上传失败
     */
    private var progress = 0f

    /**
     * 错误类型，0 上传失败 1 图片太小
     */
    private var errorType = -1

    /**
     * 图片过小情况下，是否显示红色标签
     */
    private var showMinError = false

    fun getFileRecordMainId(): String? {
        return fileRecordMainId
    }

    fun setFileRecordMainId(fileRecordMainId: String?) {
        this.fileRecordMainId = fileRecordMainId
    }

    @JvmName("getLocalMediaImage")
    fun getLocalMedia(): LocalMedia? {
        return localMedia
    }

    @JvmName("setLocalMediaImage")
    fun setLocalMedia(localMedia: LocalMedia?) {
        this.localMedia = localMedia
    }

    fun getPath(): String? {
        return path
    }

    fun setPath(path: String?) {
        this.path = path
    }

    fun isServer(): Boolean {
        return isServer
    }

    fun isNeedWater(): Boolean {
        return needWater
    }

    fun setNeedWater(needWater: Boolean) {
        this.needWater = needWater
    }

    fun getWaterUrl(): String? {
        return waterUrl
    }

    fun setWaterUrl(waterUrl: String?) {
        this.waterUrl = waterUrl
    }

    fun getPicId(): String? {
        return picId
    }

    fun setPicId(picId: String?) {
        this.picId = picId
    }

    fun setServer(server: Boolean) {
        isServer = server
    }

    fun getPicUrl_500(): String? {
        return picUrl_500
    }

    fun setPicUrl_500(picUrl_500: String?) {
        this.picUrl_500 = picUrl_500
    }


    fun getProgress(): Float {
        return progress
    }

    fun setProgress(progress: Float) {
        this.progress = progress
    }

    fun getErrorType(): Int {
        return errorType
    }

    fun setErrorType(errorType: Int) {
        this.errorType = errorType
    }

    fun isShowMinError(): Boolean {
        return showMinError
    }

    fun setShowMinError(showMinError: Boolean) {
        this.showMinError = showMinError
    }

    fun getPicUrl_50_percent(): String? {
        return picUrl_50_percent
    }

    fun setPicUrl_50_percent(picUrl_50_percent: String?) {
        this.picUrl_50_percent = picUrl_50_percent
    }

    fun getPicUrl_20_percent(): String? {
        return picUrl_20_percent
    }

    fun setPicUrl_20_percent(picUrl_20_percent: String?) {
        this.picUrl_20_percent = picUrl_20_percent
    }

    fun getImageAddress(): String? {
        return if (TextUtils.isEmpty(path)) (if (TextUtils.isEmpty(picUrl_500)) "" else picUrl_500) else path
    }

    @Throws(CloneNotSupportedException::class)
    override fun clone(): ImageInfoBean {
        return (super.clone() as ImageInfoBean)
    }

    fun getType(): String? {
        return type
    }

    fun setType(type: String?) {
        this.type = type
    }
}
